package com.SmsModule.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.List;

import util.ConnectDB;

import com.SmsModule.bean.TbSendType;

/**
 * 发送类型模块操作DAO
 * jhc
 * 2011-1-27下午01:51:28
 */
public class TbSendTypeDAO {
	private Connection conn = null;
	private PreparedStatement pt = null;
	private ResultSet rs = null;
	private boolean flag = false;
	private String sql = "";
	
	private  TbSendType tbsendtype=null;
	private  List<TbSendType> TbSendTypeList=null;
	
	/**
	 * 得到发送类型模块信息列表
	 * jhc
	 * 2011-1-27 下午01:55:27
	 */
	public List<TbSendType> getTbSendTypeAll(){
		
		return TbSendTypeList;
	}  
	/**
	 * 根据类型id查询类型名称
	 * @param args
	 */
	public TbSendType getTbSendTypeByTypeId(int inTypeId){
		try {
            conn = ConnectDB.getSqlServerConnection();
            sql = "select * from tb_sendType where typeId=?";
            pt = conn.prepareStatement(sql);
            pt.setInt(1, inTypeId);
            rs = pt.executeQuery();
            if (rs.next()) {
            	tbsendtype=this.getTbSendTypeInfo(rs);
            }

        } catch (Exception e) {
            e.printStackTrace();
        } finally {
           ConnectDB.closeSqlConnection();
        }
		return tbsendtype;
	}
	public TbSendType getTbSendTypeInfo(ResultSet rs) throws Exception{
		TbSendType sendtype=new TbSendType();
		sendtype.setTypeName(rs.getString("typeName"));
		return sendtype;
	}
	public static void main(String[] args) {
	}
}
